package com.csun.cmny.provider.service;

import com.csun.cmny.provider.model.dto.csunbutton.BedOldmanCsunButtonReqDto;
import com.csun.cmny.provider.model.dto.device.DeviceReqDto;
import com.csun.cmny.provider.model.vo.*;
import com.csun.cmny.provider.model.vo.csunsleep.DmcCsunSleepVo;
import com.csun.cmny.provider.model.vo.csunsleep.SleepAndAlert;
import com.csun.cmny.provider.service.hystrix.DmcDeviceFeignApiHystrix;
import com.csun.cmny.security.feign.OAuth2FeignAutoConfiguration;
import com.csun.cmny.util.wrapper.Wrapper;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2018-12-12 09:58
 * @Description:
 */
@FeignClient(value = "cmny-provider-dmc", configuration = OAuth2FeignAutoConfiguration.class, fallback = DmcDeviceFeignApiHystrix.class)
public interface DmcDeviceFeignApi  {

    @PostMapping(value = "/api/dmc/device/getDeviceById")
    Wrapper<DeviceReqDto> getDeviceById(@RequestParam("deviceId") Long deviceId);

    @PostMapping(value = "/api/dmc/device/queryBodySensorLocationByRoomIds")
    Wrapper<List<BodySensorReqVo>> queryBodySensorLocationByRoomIds(@RequestParam("roomIdList") List<Integer> roomIdList);

    @PostMapping(value = "/api/dmc/device/queryCsunButtonByBedOldmanList")
    Wrapper<List<CsunButtonReqVo>> queryCsunButtonByBedOldmanList(@RequestBody List<BedOldmanCsunButtonReqDto> bedOldmanCsunButtonReqDtoList);

    @PostMapping(value = "/api/dmc/device/queryRfidLabelByOldmanIds")
    Wrapper<List<RfidLabelReqVo>> queryRfidLabelByOldmanIds(@RequestParam("oldmanIdList") List<Integer> oldmanIdList);

    @PostMapping(value = "/api/dmc/alert/queryDeviceNumByGroupByDeviceType")
    Wrapper<List<DeviceCountVo>> queryDeviceNumByGroupByDeviceType(@RequestParam("groupId") Long groupId);

    @PostMapping(value = "/api/dmc/alert/breakBindDeviceByOldmanId")
    Wrapper<Integer> breakBindDeviceByOldmanId(@RequestParam("oldmanId") Long oldmanId);

    @PostMapping(value = "/api/dmc/life/selectDeviceDataByRoomId")
    Wrapper<Map> selectDeviceDataByRoomId(@RequestParam("roomId") Long roomId);

    @PostMapping(value = "/api/dmc/life/selectAlertDataByRoomId")
    Wrapper<Map> selectAlertDataByRoomId(@RequestParam("roomId")Long roomId,@RequestParam("groupId") Long groupId);

    @PostMapping(value = "/api/dmc/life/getCameraDeviceNoByLifeRoomId")
    Wrapper<List<String>> getCameraDeviceNoByLifeRoomId(@RequestParam("roomId") Long roomId);

    @PostMapping(value = "/api/dmc/life/getIsInRoomStatus")
    Wrapper<IsInRoomVO> getIsInRoomStatus(@RequestParam("roomId") Long roomId);

    @PostMapping(value = "/api/dmc/life/listDevice")
    Wrapper<List<DeviceReqVo>> listDevice(@RequestParam("deviceIdList") List deviceIdList);

    /**
     * 根据房间Id查询温湿度计数据
     *
     * @param roomIdList the room id list
     *
     * @return the humidistat req vo list
     */
    @PostMapping(value = "/api/dmc/device/queryHumidistatByRoomIds")
    Wrapper<List<HumidistatReqVo>> queryHumidistatByRoomIds(@RequestParam("roomIdList") List<Integer> roomIdList);

    /**
     * 根据房间Id查询摄像头数据
     *
     * @param roomIdList the room id list
     *
     * @return the camera req vo list
     */
    @PostMapping(value = "/api/dmc/device/queryCameraByRoomIds")
    Wrapper<List<CameraReqVo>> queryCameraByRoomIds(@RequestParam("roomIdList") List<Integer> roomIdList);

    /**
     * 根据房间Id查询网关
     *
     * @param roomIdList the room id list
     *
     * @return the gateway req vo
     */
    @PostMapping(value = "/api/dmc/device/queryGatewayByRoomIds")
    Wrapper<List<GatewayReqVo>> queryGatewayByRoomIds(@RequestParam("roomIdList") List<Integer> roomIdList);

    //查询床垫数据
    @PostMapping(value = "/api/dmc/device/querySleepInfoByRoomId")
    Wrapper<List<Map>> querySleepInfoByRoomId(@RequestParam("ids") ArrayList<Long> ids);
    //查询报警信息
    @PostMapping(value = "/api/dmc/device/querySleepAlertInfo")
    Wrapper<PageInfo> querySleepAlertInfo(@RequestParam("ids") ArrayList<Long> ids,
                                          @RequestParam(value = "isHandle" ,required = false) Integer isHandle,
                                          @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize);
    //查询床垫状态
    @PostMapping(value = "/api/dmc/device/queryInBed")
    Wrapper<List<com.csun.cmny.provider.vo.SleepDataVo>> queryInBed(@RequestParam("deviceIds") List<Long> deviceIds);
    //查询绑定了床垫的老人
    @PostMapping(value = "/api/dmc/device/querySleepBind")
    Wrapper<List<com.csun.cmny.provider.vo.RoomSleepInfo>> querySleepBind(@RequestParam("ids") ArrayList<Long> ids);
    //查询床垫时间段是否在床
    @PostMapping(value = "/api/dmc/device/querySleepInbed")
    Wrapper<List<CsunSleepDataReqVo>> querySleepInbed(@RequestParam("ids") ArrayList<Long> ids,@RequestParam("time") String time);
    //查询报警信息
    @PostMapping(value = "/api/dmc/device/queryAllSleepAlert")
    Wrapper<List<DmcDeviceAlert>> queryAllSleepAlert(@RequestParam("ids") ArrayList<Long> ids);
    //查询床垫绑定
    @PostMapping(value = "/api/dmc/device/queryGroupCsunSleepList")
    Wrapper<List<DmcCsunSleepVo>> queryGroupCsunSleepList(@RequestParam("groupId") Long groupId);
    //查询床垫绑定以及老人基本信息
    @PostMapping(value = "/api/dmc/device/queryGroupCsunSleepListByGroupId")
    Wrapper<SleepAndAlert> queryGroupCsunSleepListByGroupId(@RequestParam("groupId") Long groupId);
}
